package com.znsb.msfq.utils;

import android.content.Intent;

import com.znsb.msfq.activity.LoginActivity;
import com.znsb.msfq.activity.MainActivity;
import com.znsb.msfq.app.ZnsbApp;

/**
 * @name： 孙科技
 * @phone： 13308334117
 * @createTime： 2017/2/16
 * @modifyTime： 2017/2/16
 * @explain：
 */
public class ErrorCodeUtils {
    /**
     * C0001	通用成功
     * C0002	通用失败
     * C0003	用户登陆超时或别处登录
     * C0004	手机号错误或验证码错误
     * C0005	用户名已存在
     * C0006	手机号已注册
     * C0007	手机验证码失效
     * C0008	手机验证码错误
     * C0009	该手机还未注册
     * C0010	商品已经下架
     * C0011	账号或者密码错误
     * C0012	用户名为空
     * C0013	版本已经最新
     * C0014	身份验证失败
     * C0015	密码为空
     * C0016	确认密码为空
     * C0017	密码和确认密码不匹配
     * C0018	原密码错误
     */
    public static String code1 = "C0001";
    public static String code2 = "C0002";
    public static String code3 = "C0003";
    public static String code4 = "C0004";
    public static String code5 = "C0005";
    public static String code6 = "C0006";
    public static String code7 = "C0007";
    public static String code8 = "C0008";
    public static String code9 = "C0009";
    public static String code10 = "C0010";
    public static String code11 = "C0011";
    public static String code12 = "C0012";
    public static String code13 = "C0013";
    public static String code14 = "C0014";
    public static String code15 = "C0015";
    public static String code16 = "C0016";
    public static String code17 = "C0017";
    public static String code18 = "C0018";

    public static String getCode(String code) {
        if (code3.equals(code)) {
            SPUtils.clear(ZnsbApp.mContext);
            CacheActivityUtils.finishOtherActivity(MainActivity.class);
            Intent intent = new Intent(ZnsbApp.mContext, LoginActivity.class);
            ZnsbApp.mContext.startActivity(intent);
            return "用户登陆超时或别处登录";
        } else if (code4.equals(code)) {
            return "手机号错误或验证码错误";
        } else if (code5.equals(code)) {
            return "用户名已存在";
        } else if (code6.equals(code)) {
            return "手机号已注册";
        } else if (code7.equals(code)) {
            return "手机验证码失效";
        } else if (code8.equals(code)) {
            return "手机验证码错误";
        } else if (code9.equals(code)) {
            return "该手机还未注册";
        } else if (code10.equals(code)) {
            return "商品已经下架";
        } else if (code11.equals(code)) {
            return "账号或者密码错误";
        } else if (code12.equals(code)) {
            return "用户名为空";
        } else if (code13.equals(code)) {
            return "";
        } else if (code14.equals(code)) {
            return "身份验证失败";
        } else if (code15.equals(code)) {
            return "密码为空";
        } else if (code16.equals(code)) {
            return "确认密码为空";
        } else if (code17.equals(code)) {
            return "密码和确认密码不匹配";
        } else if (code18.equals(code)) {
            return "原密码错误";
        }
        return "系统错误";
    }
}
